import { defineConfig } from 'vite'
import uni from '@dcloudio/vite-plugin-uni'
import path from 'path'

export default defineConfig({
  plugins: [uni()],
  resolve: {
    alias: {
      '@': path.resolve(__dirname, '.'),
      '~': path.resolve(__dirname, '.')
    },
    extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json', '.vue']
  },
  optimizeDeps: {
    include: [
      // 确保动态导入的组件被预构建
      'pages/**/*.vue'
    ]
  },
	server: {
		proxy: {
			'/jkApi': {
				target: 'https://gm.cdmmotor.com:8843',
				changeOrigin: true,
				rewrite: (path) => path.replace(/^\/jkApi/, '/api')
			}
		}
	},
})